package com.robot.util;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: li
 * Date: 2019/9/8
 * Time: 17:10
 * PROJECT：robot
 * PACKAGE: com.robot
 *
 * @author:55324936@qq.com To change this template use File | Settings | File Templates.
 */
public class DubboParamTypeInit {

    public static List initParamTemplate(List<String> paramTypeList){
        List type =new ArrayList();
        for(String paramType:paramTypeList){
            if(paramType.equalsIgnoreCase("java.lang.String")||
                    paramType.equalsIgnoreCase("String")){
                type.add("paramString");
            }else if(paramType.equalsIgnoreCase(Integer.class.getName())||
                    paramType.equalsIgnoreCase("int")){
                type.add(1);
            }else if(paramType.equalsIgnoreCase(Double.class.getName())||
            paramType.equalsIgnoreCase("double")){
                type.add(1.1d);
            }else if(paramType.equalsIgnoreCase(Float.class.getName())||
                    paramType.equalsIgnoreCase("float")){
                type.add(1.1f);
            }else if(paramType.equalsIgnoreCase(Short.class.getName())||
                    paramType.equalsIgnoreCase("short")){
                type.add(1);
            }else if(paramType.equalsIgnoreCase(Long.class.getName())||
                    paramType.equalsIgnoreCase("long")){
                type.add(1l);
            }else if(paramType.equalsIgnoreCase(Boolean.class.getName())||
                    paramType.equalsIgnoreCase("boolean")){
                type.add(true);
            }else if(paramType.equalsIgnoreCase(List.class.getName())){
                List list=new ArrayList();
                list.add("param1");
                list.add("param2");
                type.add(list);
            }else if(paramType.equalsIgnoreCase(Set.class.getName())){
                Set set=new HashSet();
                set.add("setParam1");
                set.add("setParam2");
                type.add(set);
            }else if(paramType.equalsIgnoreCase(Date.class.getName())){
                type.add("2019-09-08 17:28:28");
            }else if(paramType.equalsIgnoreCase(Map.class.getName())){
                Map map=new HashMap();
                map.put("mapKey","mapValue");
                type.add(map);
            } else {
                Map map =new HashMap();
                map.put("String","value");
                map.put("Integer",1);
                map.put("boolean",true);
                type.add(map);
            }
        }
        return type;
    }
}
